<?php
$code = trim($_GET['code']);
if($code){
    $appid = "wx58677a5eef93341a";
    $secrect = "b6d9e35b46606030d4bfc14d1205c016";
    $url = "https://api.weixin.qq.com/sns/jscode2session?appid=".$appid."&secret=".$secrect."&js_code=".$code."&grant_type=authorization_code";
    //https://api.weixin.qq.com/sns/jscode2session?appid=wx58677a5eef93341a&secret=1fd576da237bbd460564a30c75d84628&js_code=051N72RH0Dxnaj2CbZUH09paRH0N72Rh&grant_type=authorization_code
    $ch = curl_init();
    curl_setopt($ch,CURLOPT_URL,$url);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $data = curl_exec($ch);
    //curl_close();
    echo json_encode($data);
}else{
	$data = array('info'=>1);
	echo json_encode($data);
}

?>